﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HotelManagement.Class;
using System.Web.Security;

namespace HotelManagement
{
    public partial class HomePage : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
         
        }

        protected void Button1_Click(object sender, EventArgs e) //Login Button
        {
            string username=TextBox1.Text;
            string password = TextBox2.Text;
            UserAccount us = HotelDBManager.getUserInfo(username, password);
            
            if (us == null) //login fail
            {
                Label1.Visible = true;
            }

            else //login success
            {
                Session["object"] = us;
                Staff s = HotelDBManager.getStaffInfoByStaffID(us.StaffID); //info details of Admin

                Session["detail"] = s;
                FormsAuthentication.RedirectFromLoginPage(username, false);
            } 
        }

        protected void LinkButton1_Click(object sender, EventArgs e) //Home button
        {
            
            Response.Redirect("~/HomePage.aspx");
        }

        protected void LinkButton2_Click(object sender, EventArgs e) //Room Availability button
        {
            Response.Redirect("~/HomePage.aspx");
        }

        protected void LinkButton3_Click(object sender, EventArgs e) //Housekeeping button
        {
            Response.Redirect("~/HomePage.aspx");
        }

        protected void LinkButton4_Click(object sender, EventArgs e) //UserManagement button
        {
            Response.Redirect("~/HomePage.aspx");
        }

        protected void LinkButton5_Click(object sender, EventArgs e) //Logout button
        {
            Response.Redirect("~/HomePage.aspx");
        }
    }
}